package com.bgds.sys.module.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bgds.sys.api.project.request.ProjectRequest;
import com.bgds.sys.api.project.response.ProjectItemResponse;
import com.bgds.sys.module.entity.project.ProjectItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author chenchao
 */
@Mapper
public interface ProjectItemMapper extends BaseMapper<ProjectItem> {

    /**
     * 分页查询数据
     */
    IPage<ProjectItemResponse> list(Page page, @Param("request") ProjectRequest request);

    ProjectItemResponse detail(@Param("id") Long id);


    List<ProjectItemResponse> detailAll(@Param("ids") List ids);


    @Select("SELECT is_exception AS isException,COUNT(1) AS `count` FROM project_item GROUP BY is_exception\n")
    List<Map<String,Object>> getStatistics();
}
